<?php
include_once 'inc/config.inc.php';
include_once 'inc/mysql.inc.php';
include_once 'inc/tool.ins.php';
$template['title'] = '学生信息查询';
$link = connect();
?>


<?php  include 'include/header.php' ?>

			!-- start: Content --><
			<div id="content" class="span10">
			<ul class="breadcrumb">
				<li>
					<i class="icon-home"></i>
					<a href="index.php">Home</a>
					<i class="icon-angle-right"></i>
				</li>
				<li><a href="#">学生信息查询</a></li>
			</ul>



				<form  method="post">
                    查询方式：
                    <select name="type" style="width:100px;color:white;background: #4bb1cf">

                        <option value="学号" select="selected">学号</option>
                        <option value="姓名">姓名</option>
                        <option value="年龄">年龄</option>
                        <option value="专业">专业</option>
                    </select>
                    查询内容：
					<input type="text" name="keys" >
					<input type="submit" name="submit" value="点击查询" >
				</form>

				<?php
                if(isset($_POST['submit'])){
                     $keys=$_POST['keys'];
                     $type=$_POST['type'];
                    include 'inc/check_student_select.php';

                     switch($type)
                         {
                             case "学号": $query="select * from student where sid=$keys";break;
                             case "姓名": $query="select * from student where name='$keys'";break;
                             case "年龄": $query="select * from student where age=$keys";break;
                             case "专业": $query="select * from student where professional='$keys' ";break;
                         }

                        $result = execute($link,$query);
                        if(!mysqli_num_rows($result)){
                                skip('student_select.php','glyphicon-remove-sign','无查询结果');
                        }
                        while($data=mysqli_fetch_assoc($result)){

                ?>
                         <table width="800" border="2" class="animated fadeInUpBig" >
                             <tr>
                                 <th>学号</th>
                                 <th>姓名</th>

                                 <th>年龄</th>
                                 <th>专业</th>
                                 <th>联系方式</th>
                                 <th>宿舍</th>
                             </tr>
                             <tr>
                                 <td align="center"><?php echo $data['sid'] ?></td>
                                 <td align="center"><?php echo $data['name'] ?></td>

                                 <td align="center"><?php echo $data['age'] ?></td>
                                 <td align="center"><?php echo $data['professional'] ?></td>
                                 <td align="center"><?php echo $data['phone'] ?></td>
                                 <td align="center"><?php echo $data['ldh']."".$data['ssh'] ?></td>

                             </tr>
                         </table>
                        <br><br><br>


                <?php

                        }
                }
                ?>



	<?php  include 'include/footer.php' ?>



</body>
</html>
